package dtd.PHS.VND_ExchangeRate.widget;

import android.content.Context;
import android.widget.RemoteViews;
import dtd.PHS.VND_ExchangeRate.R;
import dtd.PHS.VND_ExchangeRate.data.DataProvider;
import dtd.PHS.VND_ExchangeRate.data.RateItem;
import dtd.PHS.VND_ExchangeRate.utils.Helpers;

public class RateRemoteView extends RemoteViews {

	public RateRemoteView(Context context) {
		super(context.getPackageName(),R.layout.rate_widget_layout);
	}

	public void setRate(RateItem rate) {
		setTextViewText(R.id.tvDate, "VCB " + DataProvider.getInstance().getDate().toString());
		setImageViewResource(R.id.ivFlag, Helpers.getFlagIconName(rate.getCurrencyName()));
		setTextViewText(R.id.tvBuyingRate, Helpers.formatRate(rate.getBuying()));
		setTextViewText(R.id.tvSellingRate, Helpers.formatRate(rate.getSelling()));
		setTextViewText(R.id.tvTransferRate, Helpers.formatRate(rate.getTransfer()));
	}


}
